package KLTN;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;

public class LoadTextFile {

	private String path;
	BufferedReader reader = null;
	File file;
	
	public LoadTextFile(){
		path="";
	}
	
	public String readTextFile(String path){
		
		String result="",text=null;
		file = new File(path);
		try {
			reader = new BufferedReader(new FileReader(file));
			int i = 0;
			while((text = reader.readLine()) != null&&i<6){
				result = result+text+"\n";
				i++;
			}
			result=result;
		} catch (Exception e) {
			// TODO: handle exception
		}finally{
			try {
				if (reader != null) {
		            reader.close();
		        }
			} catch (Exception e) {
				// TODO: handle exception
			}
		}
		
		return result;
	}
	
	
	
}
